home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / apps / math / ols.zoo / valloc.inc < prev    next >
Encoding:
Text File  |  1993-04-16  |  479 b   |  20 lines

  1.  
  2. /* No declaration; valloc.c must declare the routines */
  3. {
  4.   VTYPE *block;
  5.   int size;
  6.  
  7.   size = h - l + 1;
  8.   block = (VTYPE *) malloc (sizeof (VTYPE) * size);
  9.   if (block == NULL)
  10.     FatalError ("malloc failure in vector allocation\n");
  11.   /* so we have the vector. */
  12.  
  13.   return block - l;
  14. }
  15.  
  16. /* Suppose we allocated p through malloc.  p is referenced from 0.
  17.    Suppose q is a p, pushed around.
  18.    q[l] = *(q+l) has got to be *p, so q+l = p so q = p - l
  19. */
  20.